var app = getApp();
Component({
    properties: {
        "swipers":{type:Object}
    },
    data: {
    },
    attached(){
            app.func.getPromise('/list/banner')
                .then(([code, res]) => {
                    this.setData({banner: res.data});
                    console.log(this.data.banner)
                })
    },
    methods: {
        jumpType: function (e) {
            let item = e.currentTarget.dataset.item;
            switch (item[`link_type`]) {
                case 0:
                    let id = item[`category_id`];
                    wx.setStorage({key: "category_id", id})
                    let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
                    if (extConfig.category = null || extConfig.category == 0) {

                        wx.navigateTo({
                            url: '/pages/index/categorysku/categorysku',
                        })
                    } else {
                        wx.navigateTo({
                            url: '/pages/index/newcategory/newcategory?id=' + id,
                        })
                    }
                    break;
                case 1:
                    wx.navigateTo({
                        url: '/pages/index/brandsku/brandsku?id=' + item['topic_id']
                    })
                    break;
                case 2:
                    wx.navigateTo({
                        url: `/pages/index/webView/webView?src=${item.link}`
                    })
                    break;
            }
        }
    }
});
